modified to always disable hotwording

From c2a0c6df7d468da9864c56f2099aa947b07e2535 Mon Sep 17 00:00:00 2001
From: amistry <amistry@chromium.org>
Date: Tue, 9 Jun 2015 12:18:39 -0700
Subject: [PATCH] Add build flag to disable hotwording.

Hotwording downloads a shared module from the web store containing a NaCl module. There is a desire to build and distribute Chromium without this happening. This change adds an "enable_hotwording" build flag that is enabled by default, but can be disabled at compile time.

BUG=491435

Review URL: https://codereview.chromium.org/1160243004

Cr-Commit-Position: refs/heads/master@{#333548}

Conflicts:
	chrome/browser/search/hotword_service.cc
---
 build/common.gypi                                 | 4 ++++
 chrome/browser/BUILD.gn                           | 9 +++++++++
 chrome/browser/search/hotword_service.cc          | 4 ++++
 chrome/browser/search/hotword_service_unittest.cc | 4 ++++
 chrome/chrome_browser.gypi                        | 3 +++
 5 files changed, 24 insertions(+)

diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc
index 0cf3c60..e93789b 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -642,6 +642,7 @@ bool HotwordService::IsServiceAvailable() {
 }
 
 bool HotwordService::IsHotwordAllowed() {
+#if defined(ENABLE_HOTWORDING_NOWAY)
   std::string group = base::FieldTrialList::FindFullName(
       hotword_internal::kHotwordFieldTrialName);
   // Allow hotwording by default, and only disable if the field trial has been
@@ -650,6 +651,9 @@ bool HotwordService::IsHotwordAllowed() {
     return false;
 
   return DoesHotwordSupportLanguage(profile_);
+#else
+  return false;
+#endif
 }
 
 bool HotwordService::IsOptedIntoAudioLogging() {
diff --git a/chrome/browser/search/hotword_service_unittest.cc b/chrome/browser/search/hotword_service_unittest.cc
index a3aef47..b0b5927 100644
--- a/chrome/browser/search/hotword_service_unittest.cc
+++ b/chrome/browser/search/hotword_service_unittest.cc
@@ -216,6 +216,7 @@ TEST_P(HotwordServiceTest, IsHotwordAllowedInvalidFieldTrial) {
 }
 
 TEST_P(HotwordServiceTest, IsHotwordAllowedLocale) {
+#if defined(ENABLE_HOTWORDING_NOWAY)
   TestingProfile::Builder profile_builder;
   scoped_ptr<TestingProfile> profile = profile_builder.Build();
 
@@ -246,6 +247,7 @@ TEST_P(HotwordServiceTest, IsHotwordAllowedLocale) {
   Profile* otr_profile = profile->GetOffTheRecordProfile();
   SetApplicationLocale(otr_profile, "en");
   EXPECT_FALSE(HotwordServiceFactory::IsHotwordAllowed(otr_profile));
+#endif  // defined(ENABLE_HOTWORDING_NOWAY)
 }
 
 TEST_P(HotwordServiceTest, ShouldReinstallExtension) {
@@ -302,6 +304,7 @@ TEST_P(HotwordServiceTest, PreviousLanguageSetOnInstall) {
 }
 
 TEST_P(HotwordServiceTest, UninstallReinstallTriggeredCorrectly) {
+#if defined(ENABLE_HOTWORDING_NOWAY)
   InitializeEmptyExtensionService();
   service_->Init();
 
@@ -372,6 +375,7 @@ TEST_P(HotwordServiceTest, UninstallReinstallTriggeredCorrectly) {
   EXPECT_TRUE(HotwordServiceFactory::IsHotwordAllowed(profile()));
   EXPECT_FALSE(hotword_service->MaybeReinstallHotwordExtension());
   EXPECT_EQ(1, hotword_service->uninstall_count());  // no change
+#endif  // defined(ENABLE_HOTWORDING_NOWAY)
 }
 
 TEST_P(HotwordServiceTest, DisableAlwaysOnOnLanguageChange) {
